package visitor;/*
 * @auther 顶风少年
 * @mail dfsn19970313@foxmail.com
 * @date 2019-08-06 18:24
 * @notify
 * @version 1.0
 */

import java.util.Enumeration;
import java.util.Vector;

public class ObjectStructure {
    private Vector nodes;

    public ObjectStructure() {
        nodes = new Vector();
    }

    public void action(Visitor visitor) {
        for (Enumeration e = nodes.elements(); e.hasMoreElements(); ) {
            Node node = (Node) e.nextElement();
            node.accept(visitor);
        }
    }

    public void add(Node node) {
        nodes.addElement(node);
    }


}
